home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: New Zealand Amiga Users Group / New Zealand Amiga Users Group Newsdisk v25 (1989-08)(NZAmigaUG).zip / New Zealand Amiga Users Group Newsdisk v25 (1989-08)(NZAmigaUG).adf / StrucBrowser / sb.src.zoo / SBGadget.c < prev    next >
C/C++ Source or Header  |  1988-06-22  |  4KB  |  113 lines

  1. /************************************************************************
  2. *                                    *
  3. *                SBGadget                *
  4. *                                    *
  5. *                17 July 89                *
  6. *                                    *
  7. *************************************************************************/
  8.  
  9. /* include not needed for Aztec C using provided makefile */
  10. #include "sb:sb.h"
  11. extern int level;
  12.  
  13.  
  14. void PrGadget(string, gadget) char *string; struct Gadget *gadget;
  15. {
  16. static struct StructData structdata[] = {
  17.      { " NextGadget",   "struct Gadget *",     5, PTRSIZE },
  18.      { "-LeftEdge",     "SHORT",               2, INTSIZE },
  19.      { "-TopEdge",      "SHORT",               2, INTSIZE },
  20.      { "-Width",        "SHORT",               2, INTSIZE },
  21.      { "-Height",       "SHORT",               2, INTSIZE },
  22.      { " Flags",        "USHORT",             12, INTSIZE },
  23.      { " Activation",   "USHORT",             12, INTSIZE },
  24.      { " GadgetType",   "USHORT",             12, INTSIZE },
  25.      { "(GadgetRender", "APTR)",               5, PTRSIZE },
  26.      { "(SelectRender", "APTR)",               5, PTRSIZE },
  27.      { " GadgetText",   "struct IntuiText *",  5, PTRSIZE },
  28.      { "-MutualExclude","LONG",                1, PTRSIZE },
  29.      { "(SpecialInfo",  "APTR)",               5, PTRSIZE },
  30.      { "-GadgetID",     "USHORT",             12, INTSIZE },
  31.      { "-UserData",     "APTR",                5, PTRSIZE }
  32.   };
  33. static char *flagnames[16] = {
  34.      "GADGHBOX",       "GADGHIMAGE",    "GADGIMAGE",      "GRELBOTTOM",
  35.      "GRELRIGHT",      "GRELWIDTH",     "GRELHEIGHT",     "SELECTED",
  36.      "GADGDISABLED"
  37.   };
  38. static char *activatenames[16] = {
  39.      "RELVERIFY",      "GADGIMMEDIATE", "ENDGADGET",      "FOLLOWMOUSE",
  40.      "RIGHTBORDER",    "LEFTBORDER",    "TOPBORDER",      "BOTTOMBORDER",
  41.      "TOGGLESELECT",   "STRINGCENTER",  "STRINGRIGHT",    "LONGINT",
  42.      "ALTKEYMAP",      "BOOLEXTEND"
  43.   };
  44. static char *systypenames[16] = {
  45.      "SIZING",         "WDRAGGING",     "SDRAGGING",      "WUPFRONT",
  46.      "SUPFRONT",       "WDOWNBACK",     "SDOWNBACK",      "CLOSE",
  47.      NULL,             NULL,            NULL,             NULL,
  48.      "REQGADGET",      "GZZGADGET",     "SCRGADGET",      "SYSGADET"
  49.   };
  50. static char *applitypenames[16] = {
  51.      "BOOLGADGET",     "GADGET0002",    "PROPGADGET",     "STRGADGET",
  52.      NULL,             NULL,            NULL,             NULL,
  53.      NULL,             NULL,            NULL,             NULL,
  54.      "REQGADGET",      "GZZGADGET",     "SCRGADGET",      "SYSGADGET"
  55.   };
  56. int sum, choice = -1;
  57. USHORT bits;
  58.   level++;
  59.   while (choice) {
  60.     sum = SetOptionText(string, structdata,
  61.                         (APTR)gadget, DATASIZE, 0);
  62.     switch (choice = GetChoice(DATASIZE)) {
  63.       case 1:
  64.         if (gadget->NextGadget)
  65.           PrGadget("The next gadget in Intuition's list", gadget->NextGadget);
  66.         break;
  67.       case 6:
  68.         bits = gadget->Flags;
  69.         switch (bits & GADGHIGHBITS) {
  70.           case 0:
  71.             flagnames[0] = "GADGHCOMP";
  72.             bits |= 0x01;
  73.             break;
  74.           case 1:
  75.             flagnames[0] = "GADGHBOX";
  76.             break;
  77.           case 2:
  78.             flagnames[1] = "GADGHIMAGE";
  79.             break;
  80.           case 3:
  81.             flagnames[1] = "GADGHNONE";
  82.             bits ^= 0x01;
  83.             break;
  84.         }
  85.         FlagPrint("Flags set for this gadget", flagnames, (ULONG)bits);
  86.         break;
  87.       case 7:
  88.         FlagPrint("Activation flags set for this gadget",
  89.                   activatenames, (ULONG)gadget->Activation);
  90.         break;
  91.       case 8:
  92.         bits = gadget->GadgetType;
  93.         if (bits & SYSGADGET) {
  94.           bits = (bits & 0xff00) | (1 << (((bits & 0xf0) >> 4) - 1));
  95.           FlagPrint("Gadget type flags set for this gadget",
  96.                 systypenames, (ULONG)bits);
  97.         }
  98.         else {
  99.           bits = (bits & 0xff00) | (1 << ((bits & 0x0f) - 1));
  100.           FlagPrint("Gadget type flags set for this gadget",
  101.                 applitypenames, (ULONG)bits);
  102.         }
  103.         break;
  104.       case 11:
  105.         if (gadget->GadgetText)
  106.           PrIntuiText("The gadget's first text (IntuiText structure)",
  107.                       gadget->GadgetText);
  108.         break;
  109.     }
  110.   }
  111.   level--;
  112. }
  113.